package com.foxzzz.binary.search;

public class Solution222 {
    public class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;

        TreeNode(int x) {
            val = x;
        }
    }

    public int countNodes(TreeNode root) {
        return root==null?0:countNodes(root.left)+countNodes(root.right)+1;
    }
}
